<?php

namespace YouBaoLian\Application\Response;

use YouBaoLian\Http\Response;

class VehicleSendSmsCodeResponse extends Response
{

    /**
     * 核保ID
     * @var string $insuredId
     */
    private $insuredId = '';

    /**
     * 短信发送状态
     * @var int $verifyCodeStatus
     */
    private $verifyCodeStatus = 0;

    /**
     * 失败信息
     * @var string $failMessage
     */
    private $failMessage = '';


    public function build(): self
    {
        parent::build();

        $this->insuredId = $this->getBizContent('insuredId');
        $this->verifyCodeStatus = $this->getBizContent('verifyCodeStatus', 0);
        $this->failMessage = $this->setMessage();

        return $this;
    }

    public function isSendSuccess(): bool
    {
        return $this->verifyCodeStatus === 3;
    }

    private function setMessage(): string
    {
        switch ($this->verifyCodeStatus) {
            case 1:
                return '等待申请';
            case 2:
                return '正在获取中';
            case 3:
                return '验证码发送成功';
            case 4:
                return '验证码发送失败';
            case 5:
                return '姓名身份证信息错误';
            case 6:
                return '申请验证码数据有误';
            case 7:
                return '请未知异常';
            case 8:
                return '申请没有状态数据';
            case 9:
                return '正在提交中';
            case 10:
                return '验证码提交成功';
            case 11:
                return '验证码提交失败';
            case 12:
                return '验证码有误重新输入';
            case 13:
                return '提交验证码数据有误';
            case 14:
                return '提交未知异常';
            case 15:
                return '提交没有状态数据';
            default:
                return '未知状态';
        }
    }

    /**
     * @return string
     */
    public function getInsuredId(): string
    {
        return $this->insuredId;
    }

    /**
     * @return int
     */
    public function getVerifyCodeStatus(): int
    {
        return $this->verifyCodeStatus;
    }

    /**
     * @return string
     */
    public function getFailMessage(): string
    {
        return $this->failMessage;
    }


}
